'\"macro stdmacro
.\"
.\" Copyright (c) 2021 Red Hat.
.\"
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by the
.\" Free Software Foundation; either version 2 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" for more details.
.\"
.\"
.TH MMV_SET_VALUE 3 "" "Performance Co-Pilot"
.SH NAME
\f3mmv_set\f1,
\f3mmv_set_value\f1,
\f3mmv_set_atomvalue\f1 \- set a value in a Memory Mapped Value file
.SH "C SYNOPSIS"
.ft 3
.ad l
.hy 0
#include <pcp/pmapi.h>
.br
#include <pcp/mmv_stats.h>
.sp
void mmv_set(void *\fIaddr\fP, pmAtomValue *\fIav\fP, void *\fIval\fP);
.br
void mmv_set_value(void *\fIaddr\fP,
'in +\w'void mmv_set_value('u
pmAtomValue\ *\fIav\fP,
double\ \fIval\fP);
.in
.br
void mmv_set_atomvalue(void *\fIaddr\fP,
'in +\w'void mmv_set_atomvalue('u
pmAtomValue\ *\fIav\fP,
pmAtomValue\ *\fIval\fP);
.in
.sp
cc ... \-lpcp_mmv \-lpcp
.hy
.ad
.ft 1
.SH DESCRIPTION
\f3mmv_set\f1,
\f3mmv_set_value\f1
and
\f3mmv_set_atomvalue\f1
provide convenient ways of directly setting a value for a
metric \f2av\f1 previously returned by the
.BR mmv_lookup_value_desc (3)
interface.
\f2addr\f1 is the address returned from
.BR mmv_stats_init (3).
.P
These interfaces are typically used with instantaneous and
discrete metrics.
Refer to
.BR mmv_inc_value (3)
for a mechanism suited to monotonic increasing counter metrics.
.P
With \f3mmv_set\f1 and
\f3mmv_set_atomvalue\f1 the value provided via the \f2val\f1
pointer must match the type of the metric and will be used as
the new value of the metric.
.P
In the case of \f3mmv_set\f1 and \f3mmv_set_value\f1, the
pointer value \f2val\f1 is internally cast to match the type of
the metric and then used as the value for the metric.
.SH SEE ALSO
.BR mmv_inc_value (3),
.BR mmv_stats_init (3),
.BR mmv_lookup_value_desc (3)
and
.BR mmv (5).
